/**     
 * @Title: RabbitMQConfig.java   
 * @Package me.mq.exchange   
 * @Description: TODO
 * @author weiwei 
 * @date 2018年5月30日 上午10:43:07   
 * @version V1.0     
 */
package me.mq.exchange;

import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: RabbitMQConfig
 * @Description: TODO
 * @author weiwei
 * @date 2018年5月30日 上午10:43:07
 * 
 */
@Configuration
public class RabbitMQConfig {

	@Bean
	public ConnectionFactory connectionFactory() {
		ConnectionFactory connectionFactory = new CachingConnectionFactory("127.0.0.1", 5672);
		return connectionFactory;
	}

	@Bean
	public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
		return new RabbitTemplate(connectionFactory);
	}
}
